clc,clear


LUT_Interleaver = [512         1536         4608        9216        18432          36864;
    768         2304         6912       13824       27648          55296;
    1024       3072         9216       18432       36864         73728;
    1280       3840         11520     23040       46080         92160;
    1536       4608         13824     27648       55296         110592];


LUT_Increment = [97         229          805            1393       3281            6985;
    145        361         1045           2089      5137            10273;
    189        481         1393           3281      6985            11141;
    201        601         1741           3481      8561            14441;
    229        805         2089           5137     10273           17329];


Data_Rates = [3200 4800 6400 8000 9600];
Interleaver_Lengths = [1 3 9 18 36 72];
% Rate_Index = find(Data_Rates==Rate);
% Interleaver_Index = find(Interleaver_Lengths==Interleaver_L);


for Rate_Index = 1:5
    for Interleaver_Index = 1:6
        
        Increment = LUT_Increment(Rate_Index,Interleaver_Index);
        % the increment value correponding to the input rate and interleaver size as mentioned in the standard
        for Index = 1:LUT_Interleaver(Rate_Index,Interleaver_Index)
            Load_Location(Index) = mod((Index-1)*Increment,LUT_Interleaver(Rate_Index,Interleaver_Index))+1;
        end

        Rate_Index
        Interleaver_Index
        eval(['save ' 'Load_Location_Rate' num2str(Data_Rates(Rate_Index)) '_Interleaver' num2str(Interleaver_Lengths(Interleaver_Index)) ' Load_Location']);
        clear Load_Location

    end
end

